<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<script src="arr.js"></script>
<script>
//	var arr=new Array(1,2,3,4);
//	for(var i=0;i<arr.length;i++){
//		alert(arr[i])
//	}
	
//用构造方法模拟数组对象
/*function array(){
	var arg=arguments;
	function myArray(){
		var leng=arg.length;
		for(var i=0;i<leng;i++){
			this[i]=arg[i]	
		};	
		this.length=leng;
	};	
	
	myArray.prototype={
		maxvalue:function(){
			if(typeof this!=='object'){
				return;	
			};
			var temp=this[0];		
			for(var i=0;i<this.length;i++){
				if(temp>this[i]){
					continue;	
				}else{
					temp=this[i];	
				}	
			};
			return temp;
		},
		order:function (type){
			if(typeof this!=='object'){
				return;	
			};	
			var arr=[];
			for(var i=0;i<this.length;i++){
				arr[i]=this[i];	
			};	
			for(var i=0;i<arr.length;i++){
				for(var j=i+1;j<arr.length;j++){
					if(type==1){
						if(arr[i]>arr[j]){
							var temp=arr[i];
							arr[i]=arr[j];
							arr[j]=temp;	
						};
					}else{
						if(this[i]<arr[j]){
							var temp=arr[i];
							arr[i]=arr[j];
							arr[j]=temp;	
						};
					}
				};	
			};
			return arr
		}
		
	};
	return new myArray();
}*/


//	var arr1=new myArray(3,54,3,67,5)
//	alert(arr1.maxvalue())
//	alert(arr1.order(1))
	var arr1=array(3,54,3,67,5)
	alert(arr1.maxvalue())
	alert(arr1.order(1))
	
	
</script>

</body>
</html>
